﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.IO;
using UofCASE.AgileProductLinerDSL.Nant;

namespace APLDTests
{
    
    
    /// <summary>
    ///This is a test class for AspenTestTest and is intended
    ///to contain all AspenTestTest Unit Tests
    ///</summary>
    [TestClass]
    public class AspenTestTest
    {
        AspenTest target;

        [TestInitialize]
        public void setup()
        {
            target = new AspenTest();
        }

        [TestMethod]
//        [Ignore]
        public void ExecuteTaskTest()
        {
            // this test currently depends on the Debugging project having been built
            String root = "../../../Debugging/Debugging";
            
            target.ProductLinerDir   = root + "/ProductLiner";
            target.Platform          = "Platform1";
            target.SolutionRoot      = root + "/..";
            target.AssemblyPath      = root + "/bin/Debug/Debugging.exe";

            target.CollectionPlan = Path.GetFullPath("../../../NantTask/AspenCollectionPlan.xml");
            target.ExecuteTask();
            
            Assert.IsTrue(File.Exists(target.ResultsDir + "/MotionDetectorTestResult.html"), "Motion detector missing.");
            Assert.IsTrue(File.Exists(target.ResultsDir + "/SetOffMotionDetectorTestResult.html"), "Set off missing.");

            Assert.IsTrue(File.Exists(target.ResultsDir + "/MotionDetectorTest.aspenLog"), "Motion detector log missing.");
            Assert.IsTrue(File.Exists(target.ResultsDir + "/SetOffMotionDetectorTest.aspenLog"), "Set of Log missing.");
                
            Assert.IsTrue(File.Exists(target.ResultsDir + "/results.xml"), "result xml missing");
        }

        [TestCleanup]
        public void tearDown()
        {
            Directory.Delete(target.ResultsDir, true);
        }

    }
}
